﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleOrmCFPC.Core.RequestsComputer.Dialects.Sqlite
{
    public class DbToSqlTypeConverter
    {
        public string ConvertType(DbType dbType, int length)
        {
            var maps = new Dictionary<DbType, string>
                           {
                               {DbType.Integer, "integer"},
                               {DbType.Float, "float"},
                               {DbType.Date, "datetime"},
                               {DbType.Char, "varchar"},
                               {DbType.Bigint, "bigint"},
                               {DbType.Blob, "blob"}
                           };
            var sqlType = maps[dbType];
            if (dbType == DbType.Char)
                sqlType += "(" + length + ")";

            return sqlType;
        }
    }
}
